home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / SHELLS / SZ2 / BCAST.DEF < prev    next >
Text File  |  1992-08-31  |  2KB  |  57 lines

  1. .Using Broadcasts vs. Commands
  2.  
  3. COMMENTS
  4. --------
  5. Demonstrate the difference between "evCommand" and "evBroadcast".
  6. This is a very simple program, with two (2) menu selections and three
  7. (3) events.
  8.  
  9. SHAZAM looks in the *.EVT file and extracts routines with the
  10. following prefixes:
  11.  
  12. PREFIX   HANDLEVENT (*.HE) file
  13. ------   ----------
  14. "hb"     create an entry in "HandleBroadcast"
  15. "hd"     create an entry in "HandleCommand"
  16.  
  17. Examine the generated code; if you are less than certain about how
  18. the code behaves, use the TP IDE/Debugger to "Trace" the chain of
  19. events, to see how "events" are routed and handled.
  20.  
  21.  +-------+
  22.  |MENUBAR|
  23.  +-------+                             +------+
  24.  Send direct    ---------------------> |Single|
  25.  Send broadcast ---------------------> |Event |
  26.                                        |Queue |
  27.                                        +------+
  28.                                          |
  29.               +-----------+              |
  30.               |  GetEvent | <------------+
  31.               +-----------+----+
  32.                                |
  33.               +-----------+ <--+
  34.        +----- |HandleEvent| <---------------+ tagged "evBroadcast"
  35.        |      +-----------+                 |
  36.        |                 |                  |
  37.        |                 |                  | "Message" calls
  38.       \/                 \/                 | ^.HandleEvent
  39.  HandleBroadcast         HandleCommand      |
  40.  ("evBroadcast")         ("evCommand")      |
  41.  ---------------         -------------      |
  42.    SendIndirect          SendBroadcast -----+
  43.               |          SendDirect
  44.               |          |
  45.              \/          \/
  46.               +------------+
  47.               |"MessageBox"|
  48.               +------------+
  49.  
  50. @PA - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  51.  
  52.  
  53.  
  54. [ MENUBAR ]
  55. 'send ~d~irect'              ;;invoke "MessageBox" directly
  56. 'send ~b~roadcast'           ;;invoke "MessageBox" via broadcast
  57.